package main

import (
	"flag"
	client2 "gark-elastic-job/client"
	"gark-elastic-job/util"
	logger "github.com/sirupsen/logrus"
	"time"
)

var clientId = flag.String("id", "", "client id which must be unique")

func main() {
	flag.Parse()
	if *clientId == "" {
		logger.Fatal("must specify the client id")
	}
	ipAddress, err := util.GetLocalIPAddress()
	if err != nil {
		logger.Fatal(err)
	}

	etcd, _ := client2.NewEtcd([]string{"127.0.0.1:2379"}, time.Second*10)
	client, err := client2.NewGarkJobClient(*clientId, "test", ipAddress, etcd)
	if err != nil {
		panic(err)
	}
	client.PushJob("com.gark.test.EchoJob", &client2.EchoJob{})
	client.Bootstrap()
}
